﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

using System.Web.Script.Services;
namespace JTicket.UI.Service
{
    /// <summary>
    /// Summary description for JT_StatSvc
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    [GenerateScriptType(typeof(JTicket.Model.C_StatInfo))]
    public class JT_StatSvc : System.Web.Services.WebService
    {
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// 
        [WebMethod]
        public bool Exists(string StatCode)
        {
            return BLL.C_StatInfo.Exists(StatCode);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// 
        [WebMethod]
        public string Add(JTicket.Model.C_StatInfo model)
        {


            if (!BLL.C_StatInfo.Exists(model.StatCode))
            {
            BLL.C_StatInfo.Add(model);
                return "添加成功！";
            }
            else
                return "该剧院编号已存在！";
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// 
        [WebMethod]
        public void Update(JTicket.Model.C_StatInfo model)
        {
            BLL.C_StatInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// 
        [WebMethod]
        public void Delete(string StatCode)
        {
            BLL.C_StatInfo.Delete(StatCode);
        }
        [WebMethod]
        public void Deletes(string StatCode)
        {
            string[] statCode = StatCode.TrimEnd('|').Split('|');
            foreach (var code in statCode)
            {
                BLL.C_StatInfo.Delete(code);
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// 
        [WebMethod]
        public JTicket.Model.C_StatInfo GetModel(string StatCode)
        {
            BLL.C_StatInfo bllStatInfo = new BLL.C_StatInfo();
            if (BLL.C_StatInfo.Exists(StatCode))
                return bllStatInfo.GetModel(StatCode);
            else
                return null;

        }

    }
}